home *** CD-ROM | disk | FTP | other *** search
/ MacHack 2001 / MacHack 2001.toast / pc / The Hacks / The Weakest Link / source / WozHack.cp < prev    next >
Encoding:
Text File  |  2001-06-23  |  1.8 KB  |  96 lines

  1. #include <Types.h>
  2. #include <Memory.h>
  3. #include <Quickdraw.h>
  4. #include <Fonts.h>
  5. #include <Events.h>
  6. #include <Menus.h>
  7. #include <TextEdit.h>
  8. #include <MacWindows.h>
  9. #if UNIVERSAL_INTERFACES_VERSION >= 0x0330
  10. #include <ControlDefinitions.h>
  11. #endif
  12. #include <Dialogs.h>
  13. #include <OSUtils.h>
  14. #include <ToolUtils.h>
  15. #include <Devices.h>
  16. #include <StandardFile.h>
  17. #include <Movies.h>
  18. #include <Sound.h>
  19. #include <QuickTimeComponents.h>
  20. #include <ImageCompression.h>
  21. #include <Resources.h>
  22. #include <FixMath.h>
  23. #include <stdio.h>
  24. #include <OpenTransport.h>
  25. #include <SIOUX.h>
  26.  
  27. #include "SortFrames.h"
  28. #include "Promiscuity.h"
  29.  
  30. bool gAllDomains;
  31.  
  32. int main( void )
  33. {
  34.     int        err = 0;
  35.     
  36.     SIOUXSettings.asktosaveonclose = false;
  37.     SIOUXSettings.columns = 120;
  38.     SIOUXSettings.rows = 40;
  39.     
  40.     err = InitOpenTransport();
  41.     if ( err )
  42.     {
  43.         printf("Error Initializing OpenTransport %d\n", err );
  44.         return 0;
  45.     }
  46.     
  47.     
  48.     char theDeviceName[256];
  49.     printf( "Starting...\n" );
  50.     printf( "Enter device name (enet1, radio0, etc):\n" );
  51.     scanf( "%s", theDeviceName );
  52.     if ( theDeviceName[0] == 0 ) return(0);
  53.  
  54.     char allOrSome[32];
  55.     printf( "SomeDomains=0, AllDomains=1:\n");
  56.     scanf( "%s", allOrSome );
  57.     if ( allOrSome[0] == '1' )
  58.         gAllDomains = true;
  59.     
  60.     err = InitializeResponses();
  61.     if ( err )
  62.     {
  63.         printf("Error Initializing the response port %d\n", err );
  64.         return 0;
  65.     }
  66.     
  67.     printf("Opening device %s\n", theDeviceName );
  68.     err = initPromiscuity( theDeviceName );
  69.     if ( err )
  70.     {
  71.         printf("Error Initializing promiscuous mode %d\n", err );
  72.         return 0;
  73.     }
  74.     
  75.     EventRecord        theEvent;
  76.     
  77.     while( true )
  78.     {
  79.         if ( WaitNextEvent( everyEvent, &theEvent, 0, 0 ) )
  80.         {
  81.             if ( theEvent.what == keyDown )
  82.                 break;
  83.             
  84.             SIOUXHandleOneEvent( &theEvent );
  85.         }
  86.         
  87.         idlePromiscuity();
  88.     }
  89.     
  90.     termPromiscuity();
  91.  
  92.     (void) CleanupResponses();
  93.     
  94.     return 0;
  95. }
  96.